import java.util.Comparator;
import java.util.PriorityQueue;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: dings
 * Date: 2024-07-27
 * Time: 11:01
 */
public class Test {
    public static void main(String[] args) {
        //原匿名内部类形式
        PriorityQueue<String> queue1 = new PriorityQueue<>(new Comparator<String>() {
            @Override
            public int compare(String o1, String o2) {
                return o2.compareTo(o1);
            }
        });
        //Lambda表达式形式
        PriorityQueue<String> queue2 = new PriorityQueue<>((o1,o2) -> o2.compareTo(o1));
    }

    public static void main1(String[] args) {
        //原匿名内部类形式
        PriorityQueue<String> queue1 = new PriorityQueue<>(new Comparator<String>() {
            @Override
            public int compare(String o1, String o2) {
                return o2.compareTo(o1);
            }
        });
    }
}
